import { defineConfig } from 'vite'
import vue from '@vitejs/plugin-vue'
import AutoImport from 'unplugin-auto-import/vite'
import path from 'path'
export default defineConfig({
  resolve: {
    alias: {
      "@": path.resolve(__dirname, "src"),
      'vue': 'vue/dist/vue.esm-bundler.js'
     },
  },
  server:{
     proxy:{
      '/shop':{
        target:'http://www.laravelshop.com/shop',
        changeOrigin:true,
        rewrite:(path)=>path.replace(/^\/shop/,'')
      },
      '/pay':{
        target:'http://www.fastpro.com',
        changeOrigin:true,
        rewrite:(path)=>path.replace(/^\/pay/,'')
      }
     }

  },
  plugins: [
    vue(),
    AutoImport({
      imports: [
        'vue',// 引入的vue
        'vue-router',// 引入的路由
        {
          // 自定义
          '@/api/index':[ // 配置全局接口
          ['default', 'Api'], 
          ],
          'vant':[
            'showNotify','showSuccessToast','showFailToast','showConfirmDialog','showImagePreview'
          ],
          'vue3-cookies':[
            'useCookies',
          ]
        }
      ]
    })
  ],
  
})
